test(spring-boot-jakarta): [Queue Instrumentation 22] Cover spring-kafka class-absence gate#5318
Draft
adinauer wants to merge 1 commit intofix/queue-instrumentation-kafka-preserve-baggagefrom
Conversation
…fka class-absence gate `SentryKafkaQueueConfiguration` in `SentryAutoConfiguration` gates the Kafka BPPs on both `org.springframework.kafka.core.KafkaTemplate` and `io.sentry.kafka.SentryKafkaProducerInterceptor` being present on the classpath. Only the latter was covered by a test. Add a `FilteredClassLoader(KafkaTemplate::class.java)` test that asserts neither `SentryKafkaProducerBeanPostProcessor` nor `SentryKafkaConsumerBeanPostProcessor` is registered when spring-kafka is missing, even with `sentry.enable-queue-tracing=true`. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Apr 21, 2026
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack (Queue Instrumentation)
📜 Description
SentryKafkaQueueConfigurationinSentryAutoConfigurationis gated on two classes being present on the classpath:Only the
SentryKafkaProducerInterceptor-missing half of that gate had test coverage. This PR adds aFilteredClassLoader(KafkaTemplate::class.java)test that asserts neitherSentryKafkaProducerBeanPostProcessornorSentryKafkaConsumerBeanPostProcessoris registered when spring-kafka is missing, even withsentry.enable-queue-tracing=true.💡 Motivation and Context
Round out the class-absence gate coverage in
SentryKafkaAutoConfigurationTestso the autoconfig contract for spring-kafka being absent is explicitly pinned by a test.💚 How did you test it?
./gradlew :sentry-spring-boot-jakarta:test --tests='io.sentry.spring.boot.jakarta.SentryKafkaAutoConfigurationTest'— 6/6 pass (incl. newdoes not register Kafka BPPs when spring-kafka is not present)../gradlew spotlessApply apiDump— clean.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.
#skip-changelog